package com.zengqingfa.shardingjdbc.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zengqingfa.shardingjdbc.demo.entity.Dict;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface DictMapper extends BaseMapper<Dict> {

    /**
     * 新增
     * @param dict
     * @return
     */
    @Insert("insert into t_dict values(#{dict.dictId},#{dict.type},#{dict.code},#{dict.value})")
    int create(@Param("dict") Dict dict);

    /**
     * 查询
     * @param id
     * @return
     */
    @Select("select * from t_dict where dict_id =#{id}")
    Dict selectByPrimary(@Param("id") Long id);
}
